/* SPDX-License-Identifier: GPL-2.0 */

#ifndef __EULEROS_DIM_CORE_DYNAMIC_BASELINE_H
#define __EULEROS_DIM_CORE_DYNAMIC_BASELINE_H

#include "dim_baseline_node.h"

#define DIM_TRAMPOLINE_NAME_SUFFIX	".trampoline"

/**
 * dim_dynamic_baseline_build() - build the dim static baseline
 *
 * if the dynamic baseline has been build, will free and rebuild.
 * this function must be called after static baseline building,
 * and dim_mem init.
 *
 * Return: 0 on success or other values on failure
 */
int dim_dynamic_baseline_build(void);

/**
 * dim_static_baseline_destroy() - free the dim static baseline
 */
void dim_dynamic_baseline_destroy(void);

/**
 * dim_dynamic_baseline_search() - search baseline data
 * @filename: filename to be searched
 * @type: baseline type
 *
 * Return: pointer to found baseline data or NULL on failure
 */
struct dim_baseline_node *dim_dynamic_baseline_search(char *filename,
						      enum dim_baseline_type type);

/**
 * dim_measure_baseline_record() - record baseline in measure log
 * and pcr
 * @name: baseline name
 * @err_info: error information, optional
 * @digest: digest data, can be NULL
 * @hash_index: hash algorithm index
 * @search_all: the range of search repate record, 1 for all log,
 *              for log after last baseline
 *
 */
void dim_measure_baseline_record(char *name,
				 const char *err_info,
				 char *digest,
				 enum dim_hash_type hash_index,
				 int search_all);

#endif
